<template>
  <div>
    <div class="detailwrapper">
      <div class="detailcontent">
        <detail-banner
          :sightName="sightName"
          :bannerImg="bannerImg"
          :bannerImgs="gallaryImgs"
        ></detail-banner>
        <detail-header></detail-header>
        <oph :gameName="gameName"></oph>
        <detailcontent></detailcontent>
      </div>
    </div>
  </div>
</template>

<script>
import DetailBanner from "./components/Banner";
import DetailHeader from "./components/Header";
import oph from "./components/oph";
import detailcontent from "./components/content";
import axios from "axios";
import Bscroll from "better-scroll";
import observeDom from "@better-scroll/observe-dom";
Bscroll.use(observeDom);
export default {
  name: "Detail",
  components: {
    DetailBanner,
    DetailHeader,
    oph,
    detailcontent,
  },
  data() {
    return {
      sightName: "",
      bannerImg: "",
      gallaryImgs: [],
      list: [],
      gameName: "",
    };
  },
  methods: {
    getDetailInfo() {
      axios
        .get("/api/detail.json", {
          params: {
            id: this.$route.params.id,
          },
        })
        .then(this.handleGetDataSucc);
    },
    handleGetDataSucc(res) {
      res = res.data;
      if (res.ret && res.data) {
        const data = res.data;
        this.sightName = data.sightName;
        this.bannerImg = data.bannerImg;
        this.gallaryImgs = data.gallaryImgs;
        this.list = data.categoryList;
      }
    },
    changeTitle() {
      let gameTitle = this.$route.query.gameName;
      this.gameName = gameTitle;
    },
  },
  mounted() {
    this, this.changeTitle();
    this.getDetailInfo();
    this.scroll = new Bscroll(".detailwrapper", {
      scrollbar: true,
      click: true,
    });
  },
};
</script>

<style lang="scss" scoped>
.detailwrapper {
  height: 100vh;
  .detailcontent {
  }
}
.content {
  height: 50rem;
}
</style>
